﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetworkIndexer.Core.Service;
using NetworkIndexer.Data.Repositories;
using NetworkIndexer.Data.DomainModels;
using NetworkIndexer.Data.Repositories.Concrete;
using NetworkIndexer.Core.Service.Concrete;
using System.IO;

namespace NetworkIndexer.Core.Repositories.Concrete
{
    public class MockIndexingRepository : IIndexingRepository
    {
        private IDataAccess _dataAccess;
        private IShareService _shareService;

        public MockIndexingRepository(IDataAccess dataAccess, IShareService shareService)
        {
            _dataAccess = dataAccess;
            _shareService = shareService;
        }

        public IList<ShareDetails> Index(IList<string> computers, string searchExtensions, bool completeRefresh)
        {
            if (completeRefresh)
                _dataAccess.ClearCache();

            var allShares = new List<ShareDetails>();

            foreach(var computer in computers)
            {
                var share = new ShareDetails{
                ShareId = Guid.NewGuid(),
                ComputerIP = computer,
                SharePath = "Test path",
                IsShareAccessible = true,
                files = new List<string>{
                "test file 1",
                "test file 2",
                "test file 3"
                }
                };

                allShares.Add(share);
                _dataAccess.AddShareToCache(share);
            }
            return allShares;
        }
    }
}



